/*
 *  Openmysee
 *
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, write to the Free Software
 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *
 */
				 
#ifndef __FINDCP_H
#define __FINDCP_H

#include <string>
#include <list>
#include <fstream>
#include <iostream>
using namespace std;	

#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>

#include "TSnew.h"

struct IPInfo
{
	unsigned long ipaddr;
	unsigned short mask;
	string nettype;
};

#ifdef __cplusplus
extern "C"{
#endif


#ifdef DEBUG
#define PDEBUG(fmt, args...)		fprintf(stderr, "TS: (%s,%d)" fmt, __FILE__, __LINE__, ## args)
#else
#define PDEBUG(fmt, args...)				do {} while (0)
#endif


int init();

int readconfig(char * filename);

const char* find_ip_from_list(unsigned long ip);

int findcppeers(unsigned long ip, void *p);
int findnettype(const char *servicetype, void* p);

void add_cp_to_list(void *p);
void remove_cp_from_list(void *p);

const char* find_cp_service_type(unsigned long ip);

#ifdef __cplusplus
}
#endif

#endif //__FINDCP_H
